/*
 * Copyright 2006-2007 S W McIlroy
 * Licensed  under the  Apache License,  Version 2.0  (the "License");
 * you may not use  this file  except in  compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed  under the  License is distributed on an "AS IS" BASIS,
 * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
 * implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.mockfu;

/**
 * A <tt>{@link Stub}</tt> is a callback which customizes the behavior and return value of a mock
 * object method invocation. Each stub is associated with one or more expectations and is executed
 * when that expectation is matched by a mock object call.
 *
 * @param <R> the return type of method
 */
public interface Stub<R>
{

    /**
     * Executes the stub.
     *
     * @param context the method invocation context
     * @return the return value of the mock object method call
     * @throws UnmatchedException to cancel the expecation match
     * @throws Throwable
     */
    public R invoke( InvocationContext context ) throws Throwable;

}
